package cn.edu.sysu.util;

import com.sina.sae.util.SaeUserInfo;

public class CONSTANT {

	public static final String STORAGE_BASE = "http://cwsalgorithm-problem.stor.sinaapp.com/";

	// This is for local usage
	public static final String DBUSER = "root";
	public static final String DBPASS = "123456";
	public static final String DB_R_URL = "localhost";
	public static final String DB_W_URL = "localhost";
	public static final String DB_PORT = "3306";
	public static final String APP_NAME = "app_cwsalgorithm";

	// This is for cloud usage
//	public static final String DBUSER = SaeUserInfo.getAccessKey();
//	public static final String DBPASS = SaeUserInfo.getSecretKey();
//	public static final String DB_R_URL = "r.rdc.sae.sina.com.cn";
//	public static final String DB_W_URL = "w.rdc.sae.sina.com.cn";
//	public static final String DB_PORT = "3307";
//	public static final String APP_NAME = "app_" + SaeUserInfo.getAppName();
	//
	public static final String MYSQL_DRIVER = "com.mysql.jdbc.Driver";

	public static String getDBReadURL() {
		return "jdbc:mysql://" + DB_R_URL + ":" + DB_PORT + "/" + APP_NAME;
	}

	public static String getDBWriteURL() {
		return "jdbc:mysql://" + DB_W_URL + ":" + DB_PORT + "/" + APP_NAME;
	}
}
